package cn.ddiancan.xddcloud.psc.flow.feign;

import java.util.List;

import cn.ddiancan.xddcloud.psc.flow.entity.XddProcess;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 流程定义数据访问层接口
 */
@FeignClient(contextId = "XddProcessService", name = "xddcloud-flow-server")
public interface XddProcessRemoteService {

    @PostMapping("/flow/process/insert")
    boolean insert(@RequestBody XddProcess process);

    @DeleteMapping("/flow/process/deleteById/{id}")
    boolean deleteById(@PathVariable("id") Long id);

    @PutMapping("/flow/process/updateById")
    boolean updateById(@RequestBody XddProcess process);

    @PutMapping("/flow/process/updateByProcessKey/{tenantId}/{processKey}")
    boolean updateByProcessKey(@RequestBody XddProcess process, @PathVariable("tenantId") String tenantId,
        @PathVariable("processKey") String processKey);

    @GetMapping("/flow/process/selectById/{id}")
    XddProcess selectById(Long id);

    @GetMapping("/flow/process/selectByProcessKeyAndVersion")
    List<XddProcess> selectListByProcessKeyAndVersion(@RequestParam(value = "tenantId",required = false) String tenantId,
        @RequestParam(value = "processKey",required = false) String processKey,
        @RequestParam(value = "version",required = false) Integer version);
}
